package org.realogic.cfm.startup;

import javax.servlet.ServletContextEvent;

import org.realogic.cfm.KSystemEnvs;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.ContextLoaderListener;

/**
 * 
 * 利用Web Sevlet Container Listener的初始化机制
 * <p>
 * web.xml
 * <p>
 * <p>
 * <listener>
 * <p>
 * <listener-class>org.realogic.cfm.startup.KServletContainerListener</listener-class>
 * <p>
 * </listener>
 * <p>
 * 
 */
public class KServletContainerListener extends ContextLoaderListener {

	protected ContextLoader createContextLoader() {
		return new ContextLoader();
	}

	public void contextInitialized(ServletContextEvent event) {
		// 初始化系统环境常量
		KSystemEnvs.getInstance().setDhtmlxGridPath(event.getServletContext().getRealPath("/WEB-INF/dhtmxgrid"));
	}

}
